package module16;

import org.openqa.selenium.By;
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.interactions.Actions;

public class Actions_Example_neocell {

	/**
	 * @param args
	 */
	public static WebDriver driver ;
	public static void main(String[] args) throws Throwable {
		driver = new FirefoxDriver();
		driver.navigate().to("http://www.vitaminshoppe.com/search/controller?N=200786468&type=brand");
		
		String topmenu_xP = "//*[@id='dropNav']/li[1]/a";
		String submenu_xp = "//*[@id='dropNav']/li[1]/ul/li[1]/div[1]/a[3]";
		
		//root
		WebElement root = driver.findElement(By.xpath(topmenu_xP));
		
		//Sub
		WebElement sub = driver.findElement(By.xpath(submenu_xp));
		
		//This will work only when the menu has <ul> <li> tags in it
		Actions builder = new Actions(driver);
		builder.moveToElement(root).build().perform();
		Thread.sleep(5000);
		sub.click();
		Thread.sleep(5000);
       driver.close();
       
       
       driver = new FirefoxDriver();
		  driver.navigate().to("http://www.espncricinfo.com");
  ((JavascriptExecutor)driver).executeScript("mopen('m2');");
Thread.sleep(5000);
  
	}

}
